pub fn new_birthday_probability(n: u32) -> f64 {
    // 当人数大于 365 时，至少两人生日相同的概率几乎为 1
    if n > 365 {
        return 1.0;
    }

    let days_in_year = 365.0;
    let mut probability_all_different = 1.0;

    for i in 0..n {
        probability_all_different *= (days_in_year - i as f64) / days_in_year;
    }

    // 至少两人生日相同的概率
    let probability_at_least_two_same = 1.0 - probability_all_different;
    
    // 保留四位小数
    (probability_at_least_two_same * 10000.0).round() / 10000.0
}